package com.mz.mattress.api.enums;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * 华为云存储枚举
 */
public enum ObsEnum {

//    bucketName: hotels
//    urlOld: https://hotels.obs.cn-east-3.myhuaweicloud.com:443
//    urlNew: https://img.hwhhotels.com

//    bucketName: automall
//    urlOld: https://automall.obs.cn-east-3.myhuaweicloud.com:443
//    urlNew: https://img.hwhautomall.com

//    bucketName: hwh-pms
//    urlOld: https://hwh-pms.obs.cn-east-3.myhuaweicloud.com:443
//    urlNew: https://hwh-pms.hwhhotels.com

//    bucketName: apt-10a2
//    urlOld: https://apt-10a2.obs.cn-east-3.myhuaweicloud.com:443
//    urlNew: https://apt.hwhhotels.com

//    bucketName: automall
//    urlOld: https://automall.obs.cn-east-3.myhuaweicloud.com:443
//    urlNew: https://img.hwhautomall.com

//      bucketName: hwh-car
//      urlOld: https://hwh-car.obs.cn-east-3.myhuaweicloud.com:443
//      urlNew: https://hwh-car.hwhautomall.com

    HOTELS("hotels", "https://hotels.obs.cn-east-3.myhuaweicloud.com:443", "https://img.hwhhotels.com"),
    AUTOMALL("automall", "https://automall.obs.cn-east-3.myhuaweicloud.com:443", "https://img.hwhautomall.com"),
    HWH_PMS("hwh-pms", "https://hwh-pms.obs.cn-east-3.myhuaweicloud.com:443", "https://hwh-pms.hwhhotels.com"),
    APT("apt-10a2", "https://apt-10a2.obs.cn-east-3.myhuaweicloud.com:443", "https://apt.hwhhotels.com"),
    HWH_CAR("hwh-car", "https://hwh-car.obs.cn-east-3.myhuaweicloud.com:443", "https://hwh-car.hwhautomall.com"),
    QCC_CAR("qcc-car", "https://qcc-car.obs.cn-east-3.myhuaweicloud.com:443", "https://qcc-car.hwhautomall.com"),
    DY_CAR("dy-car", "https://dy-car.obs.cn-east-3.myhuaweicloud.com:443", "https://dy.hwhautomall.com"),
    ;

    //桶名称
    public final String bucketName;

    //原生URL
    public final String rawUrl;

    //新的映射URL
    public final String mapUrl;


    ObsEnum(String bucketName, String rawUrl, String mapUrl) {
        this.bucketName = bucketName;
        this.rawUrl = rawUrl;
        this.mapUrl = mapUrl;
    }

    private static Map<String, ObsEnum> map = new HashMap<>();

    static {

        for (ObsEnum obsEnum : ObsEnum.values()) {
            map.put(obsEnum.bucketName, obsEnum);
        }

    }

    public static ObsEnum getById(String value) {
        return map.get(value);
    }

    public static Set<String> keys() {
        return map.keySet();
    }

    public static void main(String[] args) {

        Set<String> keys = keys();
        System.out.println(keys);

        System.out.println("H000002".length());

    }
}
